package com.example.cms.service.Impl;

import com.example.cms.dao.OptionsDao;
import com.example.cms.dao.QuestionTitleDao;
import com.example.cms.dao.QuestionnairedDao;
import com.example.cms.entity.Options;
import com.example.cms.entity.Questionnaired;
import com.example.cms.entity.Questionnairefile;
import com.example.cms.pojo.Mesagge;
import com.example.cms.pojo.QueryPage;
import com.example.cms.pojo.QuestionTitleItem;
import com.example.cms.service.QuestionnairedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service("QuestionnairedService")
@Transactional
public class QuestionnairedServiceImpl implements QuestionnairedService {

    @Autowired
    private QuestionnairedDao questionnairedDao;
    @Autowired
    private OptionsDao optionsDao;
    @Autowired
    private QuestionTitleDao questionTitleDao;

    @Override
    public List<Questionnaired> getAllQues() {
        return questionnairedDao.selectAllQuestion();
    }

    @Override
    public List<Questionnaired> findPage(QueryPage queryPage, Mesagge mesagge) {

        return null;
    }

    @Override
    public List<Questionnaired> findeQuestionNaireId(Integer questionNairedId) {
     List<Questionnaired> list= questionnairedDao.selectQuesById(questionNairedId);
     return list;
    }

    @Override
    public Mesagge deletQuestionNaired(Integer questionNairedid) {
    int i=  questionnairedDao.deleteQuestion(questionNairedid);
    Mesagge mesagge =new Mesagge();
    mesagge.setMesCode(i);
    return mesagge;
    }

    @Override
    public Mesagge insertQuestionNaired(Questionnaired questionnaired, Mesagge mesagge) {
       int i= questionnairedDao.insertQues(questionnaired);
       mesagge.setMesCode(i);
       return mesagge;
    }

    /**
     * @Author Sunbird
     * @Description
     * @Date  2018/12/20
     * @Param
     * @return
     **/

    @Override
    public List<Questionnaired> selectQuestionName(String QuestionName) {
        return null;
    }

    /**
     * @Author Sunbird
     * @Description 根据新增问卷题目
     * @Date  2018/12/20
     * @Param
     * @return
     **/
    @Override
    public void insertQuestTitle(Questionnairefile questionnairefile, Mesagge mesagge) {

    }
/**
 * @Author Sunbird
 * @Description 根据试卷名删除题目
 * @Date  2018/12/20
 * @Param
 * @return
 **/
    @Override
    public void deletQuestTitle(Integer questionnairedfileId, Mesagge mesagge) {

    }
/**
 * @Author Sunbird
 * @Description 根据题目id 查询选项
 * @Date  2018/12/20
 * @Param
 * @return
 **/
    @Override
    public List<Options> optionsByQuestionnaireFileId(Integer QuestionnaireFileId) {
        return  optionsDao.findQuestionnaireFileId(QuestionnaireFileId);
    }

    /**
     * @Author Sunbird
     * @Description 删除选项
     * @Date  2018/12/20
     * @Param
     * @return
     **/

    @Override
    public void detleOptions(Mesagge mesagge, QuestionTitleItem options) {

    }
    /*
     * @Author Sunbird
     * @Description 修改选项
     * @Date  2018/12/20
     * @Param
     * @return
     **/

    @Override
    public void updataOptions(Mesagge mesagge, QuestionTitleItem options) {

    }

    @Override
    public void insertOptions(Mesagge mesagge, QuestionTitleItem qptions) {

    }


}
